package com.jiyun.information.controller;

import com.jiyun.information.service.InformationService;
import com.jiyun.pojo.information.vo.ComplaintVo;
import com.jiyun.pojo.information.vo.MessageVo;
import com.jiyun.pojo.order.OrderComplaint;
import com.jiyun.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/information")
public class InformationController {
    @Autowired
    private InformationService informationService;

    /**
     * 查找所有投诉信息
     *
     * @return
     */
    @GetMapping("/complaintList")
    public Result complaintList(String userId) {
        List<ComplaintVo> list = informationService.complaintList(userId);
        return Result.ok(list);
    }

    /**
     * 查找某个订单的投诉信息
     *
     * @param orderId
     * @return
     */
    @GetMapping("/getComplaint")
    public Result getComplaint(String orderId) {
        OrderComplaint orderComplaint = informationService.getComplaint(orderId);
        return Result.ok(orderComplaint);
    }

    /**
     * 查找订单状态信息个数
     */
    @GetMapping("/getOrderStatusCount")
    public Result getOrderStatusCount(String userId) {
        List<HashMap<Integer, Integer>> count = informationService.getOrderStatusCount(userId);
        return Result.ok(count);
    }

    /**
     * 查找消息列表
     *
     * @return
     */
    @GetMapping("/messageList")
    public Result messageList(String userId) {
        List<MessageVo> list = informationService.messageList(userId);
        return Result.ok(list);
    }
}
